/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package it.trick.admin.task;

import it.trick.admin.model.ChannelModel;
import it.trick.admin.service.ChannelService;
import javafx.concurrent.Service;
import javafx.concurrent.Task;

/**
 *
 * @author takahara
 */
public class AddChannelTask extends Service<ChannelModel> {

    private ChannelModel channelModel;

    public void setup(ChannelModel channelModel) {
        this.channelModel = channelModel;
    }

    @Override
    protected Task createTask() {
        return new Task<ChannelModel>() {
            @Override
            protected ChannelModel call() throws Exception {

                ChannelModel model = ChannelService.addChannel(channelModel);

                return model;
            }
        };
    }
}
